package com.alameda.controller.v1.danmaku;

import com.alameda.common.result.Result;
import com.alameda.danmaku.dto.ApVideoDanmakuDTO;
import com.alameda.pojo.danmaku.ApVideoDanmakuDO;
import com.alameda.service.danmaku.ApVideoDanmakuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 视频弹幕 前端控制层
 *
 * @author Lv
 * @date 2024/10/07
 */
@Api(tags = "视频弹幕")
@RestController
@RequestMapping("/ap_video_danmaku")
public class ApVideoDanmakuController {

    @Autowired
    private ApVideoDanmakuService apVideoDanmakuService;

    /**
     * 保存弹幕
     *
     * @param apVideoDanmakuDO 视频弹幕
     * @return
     */
    @ApiOperation("保存弹幕")
    @PostMapping("/save")
    public Result<?> save(@RequestBody ApVideoDanmakuDO apVideoDanmakuDO) {
        return Result.success(apVideoDanmakuService.saveDanmaku(apVideoDanmakuDO));
    }

    /**
     * 查询弹幕
     *
     * @param apVideoDanmakuDTO 视频弹幕信息
     * @return
     */
    @ApiOperation("查询弹幕")
    @PostMapping("/load")
    public Result<?> load(@RequestBody ApVideoDanmakuDTO apVideoDanmakuDTO) {
        return Result.success(apVideoDanmakuService.load(apVideoDanmakuDTO));
    }
}

